package windows.propertyWindow 
{
	import com.bit101.components.InputText;
	import com.bit101.components.Label;
	import flash.display.Sprite;
	import com.bit101.components.PushButton;
	import flash.events.MouseEvent;
	import flash.events.Event;
	/**
	 * ...
	 * @author yaempechenki@gmail.com
	 */
	public class PropertyFormView extends Sprite 
	{
		private var widthInput:InputText;
		private var heightInput:InputText;
		private var myLabel1:Label;
		private var myLabel2:Label;
		private var sketchButton:PushButton;
		public function PropertyFormView() 
		{
			myLabel1 = new Label(this, 10, 0, "form size");
			widthInput = new InputText(this, 10, 20, "400", onWidthHeightTextChange);
			widthInput.width = 45;
			myLabel2 = new Label(this, 55, 20, "x");
			heightInput = new InputText(this, 65, 20, "400", onWidthHeightTextChange);
			heightInput.width = 45;
			
			sketchButton = new PushButton(this, 10, 50, "load sketch", onSketchClick);
		}
		
		private function onWidthHeightTextChange(event:Event):void {
			var data:Object = { width:int(widthInput.text), height:int(heightInput.text) };
			dispatchEvent(new GuiEvent(GuiEvent.FORM_SIZE_CHANGED, data));
		}
		
		private function onSketchClick(event:MouseEvent):void {
           dispatchEvent(new GuiEvent(GuiEvent.ADD_SKETCH));
        }
		
	}

}